package com.eastfair.auth.controller;

import com.eastfair.auth.enumeration.ResourceOrganizationResourceTypeEnum;
import com.eastfair.auth.service.OrganizationService;
import com.eastfair.auth.service.ProjectOrganizationService;
import com.eastfair.auth.service.SponsorUserOrganizationService;
import com.eastfair.auth.dto.OrganizationDTO;
import com.eastfair.core.base.R;
import com.eastfair.echo.core.EchoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 主办controlelr
 *
 * </p>
 *
 * @author ligang
 * @date 2021-07-16
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/sponsorUserOrganization")
@Api(value = "sponsorUserOrganization", tags = "")
public class SponsorUserOrganizationController {

    @Autowired
    private EchoService echoService;

    @Autowired
    SponsorUserOrganizationService sponsorUserOrganizationService;

    @Autowired
    ProjectOrganizationService projectOrganizationService;

    @Autowired
    OrganizationService organizationService;

    /**
     * 添加主办到项目
     * @param organizationDTO 组织实体
     * @return
     */
    @ApiOperation(value = "添加主办到项目", notes = "添加主办到项目")
    @PostMapping("/addHostByProject")
    public R addHostByProject(@RequestBody @Validated({OrganizationDTO.addHostByProject.class }) OrganizationDTO organizationDTO) {
        organizationDTO.setResourceType(ResourceOrganizationResourceTypeEnum.HOST);
        return sponsorUserOrganizationService.addHostByProject(organizationDTO);
    }


}
